home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / DOC.PAK / INTLDEMO.TXT < prev    next >
Text File  |  1997-05-06  |  8KB  |  146 lines

  1. ===========================================================================
  2. International API
  3. ===========================================================================
  4.  
  5.  
  6.                     Borland C++ provides support for international program
  7.                     development. Currently, support is provided for the
  8.                     Great Britain and United States English, French, and
  9.                     German locales. Future releases of Borland C++ will
  10.                     increase the number of locales supported.
  11.  
  12.     The LOCALE.BLL  Support for these locales is contained in the
  13.  file is installed  LOCALE.BLL library. By default, the "C" locale is in
  14.        in BC5\BIN   effect. However, a call to setlocale dynamically links
  15.         directory.  the LOCALE.BLL library to your program. A locale-
  16.                     specific module is enabled by a call to setlocale. The
  17.                     call will also specify which character set to use with
  18.                     the locale. (Character set is sometimes referred to as
  19.                     "code page" or "code set.") You can query the locale
  20.                     settings by using localeconv and setlocale functions.
  21.                     See the Library Reference, Chapter 3, for a description
  22.                     of these functions.
  23.  
  24.                     If the call to setlocale can be resolved, several
  25.                     character-handling functions change their behavior.
  26.                     Because Borland C++ 5.0 international API currently
  27.                     supports only 8-bit characters (thereby enabling
  28.                     recognition of as many as 256 characters), only
  29.                     single-byte character-handling functions are affected.
  30.                     The list of affected functions is in the Library
  31.                     Reference, Chapter 1.
  32.  
  33.                     In your code, you must #define _ _USELOCALES_ _to have
  34.                     the locale-sensitive functions available. Otherwise,
  35.                     only the "C" locale macros will be used.
  36.  
  37.  
  38.  The international  =======================================================
  39. API sample program
  40.                     To illustrate the effects of selecting different
  41.                     locales, Borland C++ provides a sample program. The
  42.                     sample program (named INTLDEMO.EXE) is an ObjectWindows
  43.                     application. All source code and a project file for the
  44.                     sample are provided. The sample program INTLDEMO (in
  45.                     BC5\EXAMPLES\OWL\APPS\INTLDEMO) demonstrates how the
  46.                     setlocale function can produce an "internationally
  47.                     aware" Windows application. You can switch the inter-
  48.                     face language at run time between English, French, and
  49.                     German.
  50.  
  51.  
  52.                                                                           1
  53.  
  54.  
  55.                     INTLDEMO displays all of the Windows ANSI character set
  56.                     (also referred to as the WIN 1252 character set) in a
  57.                     16-by-16 character grid. A number of characters are
  58.                     highlighted according to the selections under the
  59.                     "Locale" and the "Classification" menus. When you
  60.                     execute INTLDEMO, the screen shows the default "C"
  61.                     locale, and the default classification is isalpha. The
  62.                     highlighted characters are therefore the characters A
  63.                     to Z  and a to z. By selecting another locale (for
  64.                     example, French) the accented versions of the
  65.                     characters (for example é) are also highlighted.
  66.                     Various combinations of locale and classification can
  67.                     be illustrated by selecting the appropriate menu items.
  68.  
  69.                     The results of calling the localeconv function for the
  70.                     current locale are illustrated by selecting
  71.                     "Conventions|Show". For example, with the French locale
  72.                     selected, the international currency symbol becomes FRF
  73.                     and the currency symbol becomes F. Note that this
  74.                     window can remain open while either the language or
  75.                     locale is changed and the values are updated
  76.                     accordingly.
  77.  
  78.                     The "File|List" menu produces a dialog box that
  79.                     demonstrates the effects of the locale on collation
  80.                     sequences and on date and time functions. The files in
  81.                     the current directory are shown sorted according to the
  82.                     current locale, and with date and times displayed
  83.                     according to the conventions and in the language of the
  84.                     selected locale. File names can be switched between
  85.                     upper/lower case to demonstrate the effects of the
  86.                     toupper and tolower functions in the current locale.
  87.                     The dialog also illustrates the effects of the
  88.                     BWCCIntlInit function on the Ok, Cancel and Help
  89.                     buttons of the dialog. Any file can be selected to be
  90.                     viewed and its contents similarly sorted according to
  91.                     the current locale collation sequence.
  92.  
  93.                     The "Language" menu allows the language of the UI to be
  94.                     changed "on the fly." This feature uses ObjectWindow's
  95.                     ability to associate windows interface elements to a
  96.                     module, in this case a .DLL that contains the resources
  97.                     in a particular language. When the language is changed,
  98.                     a new language .DLL is loaded and the interface
  99.                     elements are reloaded from that .DLL. Note that the
  100.                     date and times in the File List dialog are not affected
  101.                     by the change in language, but by the choice of locale.
  102.  
  103.                     The 'Classification' menu shows a list of the locale-
  104.                     sensitive isxxx() functions. Selecting one of these
  105.                     items will cause the characters that return true for
  106.                     this function in the current locale to be highlighted
  107.                     in the main window.
  108.  
  109.  
  110.                     INTLDEMO also supports multi-lingual OLE automation. 
  111.                     Commands are exposed which allow a controller to select
  112.                       1. the locale, 
  113.                       2. the language of the UI, 
  114.                       3. the classification function. 
  115.  
  116.                     These commands are available in English, French and 
  117.                     German. A controller program, CALLDEMO, is provided, 
  118.                     which illustrates this process.
  119.  
  120.                     By default, the type library will be generated according
  121.                     to the current Control Panel settings. For example,
  122.                     running INTLDEMO with the -Typelib switch under French
  123.                     settings will generate intldemo.olb in French.
  124.  
  125.                     To generate the type library in a given language, use
  126.                     the -Language switch. For example,
  127.                       intldemo.exe -Language=7 -Typelib=german.olb
  128.                     will generate a German type library called german.olb.
  129.  
  130.                     Some localized BASIC scripts are also provided. These 
  131.                     scripts can be run from a VBA apllication, such as Excel.
  132.                     In order to run the French or German scripts in the US 
  133.                     version of Excel, it is necessary to load the appropriate
  134.                     localized object libraries. This process is fully 
  135.                     explained    in the description of the AUTOCALC example 
  136.                     program.
  137.  
  138.                     In addition, Excel can be used to browse the type library 
  139.                     information. For example, browsing the German version of
  140.                     the type library displays localized names of methods and 
  141.                     properties, as well as brief descriptions. Localized 
  142.                     help text can also be invoked.
  143.  
  144.  
  145. 
  146.